<?php

namespace App\Http\Controllers;

use App\Models\ActivityProjectVideo;
use App\Models\Maker;
use App\Models\Project;
use App\Models\Topic;
use App\Models\TopicComment;
use App\Models\User;
use Illuminate\Http\Request;

use App\Http\Requests;
use App\Http\Controllers\Controller;
use App\User as AUser;

class TopicCommentController extends CommonController
{
    /**
     * 获取某专题评论列表
     */
    public function getIndex(Request $request)
    {
        $data = $request->input();

        $lists = TopicComment::with('topic', 'user')->where('topic_id', $data['id'])->orderBy('id', 'asc')->paginate(10);
        $topic = Topic::where('id', $data['id'])->first();

        $actions = AUser::getPermissionAction(1231, 1);

        return view('topiccomment.index')->with("lists", $lists)->with("topic", $topic)->with("actions", $actions);
    }

    public function postDelete(Request $request)
    {
        $data = $request->input();
        TopicComment::where('id', $data['cid'])->delete();

        return AjaxCallbackMessage('删除成功', true, url('topiccomment/index?id=').$data['cid']);
    }
}
